\hypertarget{classsynque}{
\section{synque$<$ \_\-Tp, SIZE, \_\-Sequence $>$ Class Template Reference}
\label{classsynque}\index{synque@{synque}}
}
Synchronized FIFO queue.  


\subsection*{Public Types}
\begin{CompactItemize}
\item 
\hypertarget{classsynque_8487f4741373513feb4c277edd67de20}{
typedef \_\-Sequence::value\_\-type \textbf{value\_\-type}}
\label{classsynque_8487f4741373513feb4c277edd67de20}

\item 
\hypertarget{classsynque_52a428e90c2d82fa99071ad2c4d12d06}{
typedef \_\-Sequence::reference \textbf{reference}}
\label{classsynque_52a428e90c2d82fa99071ad2c4d12d06}

\item 
\hypertarget{classsynque_9af5d6e7653b8b6a3456e4cbfb034df8}{
typedef \_\-Sequence::const\_\-reference \textbf{const\_\-reference}}
\label{classsynque_9af5d6e7653b8b6a3456e4cbfb034df8}

\item 
\hypertarget{classsynque_21985ab8197c3ef0e344e2bb7c403181}{
typedef \_\-Sequence::size\_\-type \textbf{size\_\-type}}
\label{classsynque_21985ab8197c3ef0e344e2bb7c403181}

\item 
\hypertarget{classsynque_5cbab49de8281272dabe52e7160571ff}{
typedef \_\-Sequence \textbf{container\_\-type}}
\label{classsynque_5cbab49de8281272dabe52e7160571ff}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hyperlink{classsynque_9160bf426e9f9198e0f4e540bf370baf}{synque} (const \_\-Sequence \&c=\_\-Sequence())
\item 
\hyperlink{classsynque_665cab1f850c4f4752de6d8c105c483e}{$\sim$synque} ()
\item 
\hypertarget{classsynque_b7f8986b391564564a25db491ae7e72f}{
bool \hyperlink{classsynque_b7f8986b391564564a25db491ae7e72f}{empty} (void)}
\label{classsynque_b7f8986b391564564a25db491ae7e72f}

\begin{CompactList}\small\item\em Returns true if container is empty. \item\end{CompactList}\item 
\hypertarget{classsynque_bbdc31b5ca23cab9ae0261079d850d1d}{
size\_\-type \hyperlink{classsynque_bbdc31b5ca23cab9ae0261079d850d1d}{size} (void)}
\label{classsynque_bbdc31b5ca23cab9ae0261079d850d1d}

\begin{CompactList}\small\item\em Returns size. \item\end{CompactList}\item 
\hypertarget{classsynque_6e75ab1ddc1327cbaa3288c0607653de}{
void \hyperlink{classsynque_6e75ab1ddc1327cbaa3288c0607653de}{push} (const value\_\-type \&x)}
\label{classsynque_6e75ab1ddc1327cbaa3288c0607653de}

\begin{CompactList}\small\item\em Insert element concurrently. \item\end{CompactList}\item 
\hypertarget{classsynque_285d8e08274ae46946b4521aaf05c69e}{
value\_\-type \hyperlink{classsynque_285d8e08274ae46946b4521aaf05c69e}{pop} (void)}
\label{classsynque_285d8e08274ae46946b4521aaf05c69e}

\begin{CompactList}\small\item\em Access next element and delete it concurrently. It's necessary to perform the two actions 'atomically' to avoid inconsistency. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
\_\-Sequence \hyperlink{classsynque_dde766511844b42a08a4576f194271e3}{\_\-\_\-c}
\item 
boost::mutex \hyperlink{classsynque_e77ebdf115cfee2670978cf806641466}{\_\-\_\-queue\_\-m}
\item 
boost::condition\_\-variable \hyperlink{classsynque_fb1a12e8c90467e6486cb9fb268e4fe7}{\_\-\_\-non\_\-empty\_\-c}
\item 
boost::condition\_\-variable \hyperlink{classsynque_f68368f2d30468404d71d96dc015468d}{\_\-\_\-non\_\-full\_\-c}
\end{CompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ class synque$<$ \_\-Tp, SIZE, \_\-Sequence $>$}

Synchronized FIFO queue. 

Synchronized queue is a container adaptor used in a FIFO context that provide a concurrent behaviour avoiding producers and consumers to handle concurrency explicitely. In order to do so, there are two differences between a STL queue and a \hyperlink{classsynque}{synque}:

1. SIZE By default queues have not a maximum size. A synque must know wether or not the container is supposed to have a maximum size, because in this case a container-full condition variable should be handled in order to make producers wait.

2. POP ELEMENTS The pop mechanism must include either the access to the next element and its removal from the container. The presence of more than one consumer could raise problems.

It is possible to specify another type of container, but it must implement following methods: push\_\-back(), pop\_\-front() and front(); 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classsynque_9160bf426e9f9198e0f4e540bf370baf}{
\index{synque@{synque}!synque@{synque}}
\index{synque@{synque}!synque@{synque}}
\subsubsection[synque]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ {\bf synque}$<$ \_\-Tp, SIZE, \_\-Sequence $>$::{\bf synque} (const \_\-Sequence \& {\em c} = {\tt \_\-Sequence()})\hspace{0.3cm}{\tt  \mbox{[}inline, explicit\mbox{]}}}}
\label{classsynque_9160bf426e9f9198e0f4e540bf370baf}


Constructor. \hypertarget{classsynque_665cab1f850c4f4752de6d8c105c483e}{
\index{synque@{synque}!$\sim$synque@{$\sim$synque}}
\index{$\sim$synque@{$\sim$synque}!synque@{synque}}
\subsubsection[$\sim$synque]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ {\bf synque}$<$ \_\-Tp, SIZE, \_\-Sequence $>$::$\sim${\bf synque} ()\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{classsynque_665cab1f850c4f4752de6d8c105c483e}


Destructor. 

\subsection{Member Data Documentation}
\hypertarget{classsynque_dde766511844b42a08a4576f194271e3}{
\index{synque@{synque}!\_\-\_\-c@{\_\-\_\-c}}
\index{\_\-\_\-c@{\_\-\_\-c}!synque@{synque}}
\subsubsection[\_\-\_\-c]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ \_\-Sequence {\bf synque}$<$ \_\-Tp, SIZE, \_\-Sequence $>$::{\bf \_\-\_\-c}\hspace{0.3cm}{\tt  \mbox{[}protected\mbox{]}}}}
\label{classsynque_dde766511844b42a08a4576f194271e3}


Underlying container. \hypertarget{classsynque_e77ebdf115cfee2670978cf806641466}{
\index{synque@{synque}!\_\-\_\-queue\_\-m@{\_\-\_\-queue\_\-m}}
\index{\_\-\_\-queue\_\-m@{\_\-\_\-queue\_\-m}!synque@{synque}}
\subsubsection[\_\-\_\-queue\_\-m]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ boost::mutex {\bf synque}$<$ \_\-Tp, SIZE, \_\-Sequence $>$::{\bf \_\-\_\-queue\_\-m}\hspace{0.3cm}{\tt  \mbox{[}protected\mbox{]}}}}
\label{classsynque_e77ebdf115cfee2670978cf806641466}


Container-guarding mutex. \hypertarget{classsynque_fb1a12e8c90467e6486cb9fb268e4fe7}{
\index{synque@{synque}!\_\-\_\-non\_\-empty\_\-c@{\_\-\_\-non\_\-empty\_\-c}}
\index{\_\-\_\-non\_\-empty\_\-c@{\_\-\_\-non\_\-empty\_\-c}!synque@{synque}}
\subsubsection[\_\-\_\-non\_\-empty\_\-c]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ boost::condition\_\-variable {\bf synque}$<$ \_\-Tp, SIZE, \_\-Sequence $>$::{\bf \_\-\_\-non\_\-empty\_\-c}\hspace{0.3cm}{\tt  \mbox{[}protected\mbox{]}}}}
\label{classsynque_fb1a12e8c90467e6486cb9fb268e4fe7}


Empty container condition variable. \hypertarget{classsynque_f68368f2d30468404d71d96dc015468d}{
\index{synque@{synque}!\_\-\_\-non\_\-full\_\-c@{\_\-\_\-non\_\-full\_\-c}}
\index{\_\-\_\-non\_\-full\_\-c@{\_\-\_\-non\_\-full\_\-c}!synque@{synque}}
\subsubsection[\_\-\_\-non\_\-full\_\-c]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename \_\-Tp, unsigned long SIZE = 0, typename \_\-Sequence = std::deque$<$\_\-Tp$>$$>$ boost::condition\_\-variable {\bf synque}$<$ \_\-Tp, SIZE, \_\-Sequence $>$::{\bf \_\-\_\-non\_\-full\_\-c}\hspace{0.3cm}{\tt  \mbox{[}protected\mbox{]}}}}
\label{classsynque_f68368f2d30468404d71d96dc015468d}


Full container condition variable. 

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
synque.cpp\end{CompactItemize}
